/**
 * @param {string} s
 * @param {string} t
 * @return {boolean}
 */
var func1 = (a) =>
  a
    .split('')
    .sort((a, b) => a.charCodeAt() - b.charCodeAt())
    .toString();
var isAnagram = function (s, t) {
  return func1(s) === func1(t);
};
console.log(isAnagram('anagram', 'nagaram'));
